#include "stack.h"
#include <assert.h>

int stack_test(void)
{
    printf("** stack test:\n");
    stack_t *stack = stack_create(1024, NULL);
    assert(stack);

    uint32_t i;
    for(i = 0; i < 1024; i++){
        assert(stack_push(stack, (void *)i) == 0);
    }
    printf("stack push success\n");

    void *data;
    uint32_t v;
    for(i = 0; i < 1024; ++i){
        data = stack_pop(stack);
        v = (uint32_t)data;
        printf("data = %d\n", v);
    }
    printf("stack pop success\n");


    stack_destroy(&stack, NULL);
    printf("** stack test success\n");
    return 0;
}
